package cn.edu.sdju.fengguoyu.ahoedgemonitor;

import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.Cursor;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.stage.Stage;

import java.net.URL;
import java.util.ResourceBundle;

public class SettingWindows implements Initializable {
    @FXML
    public TextField dnsServer;
    @FXML
    public Button btnSave;


    @Override
    public void initialize(URL location, ResourceBundle resources) {
            dnsServer.setText(App.defaultDNS);
            btnSave.setCursor(Cursor.HAND);
            btnSave.setOnAction(event -> {
                if (!dnsServer.getText().equals("")) {
                    App.defaultDNS = dnsServer.getText();
                    System.out.println("Setting dns to "+App.defaultDNS);
                    Stage stage = (Stage) btnSave.getScene().getWindow();
                    stage.close();
                }
            });
    }
}
